
#include "iostream"
#include "vector"
#include "unordered_map"
#include "algorithm"
#include "string"
#include "list"
class Solution{
public:
};


int main() {
    std::list<int> list1;
    bool summing=false;
    int sum=0;
    int c_cnt=0;
    while(1){
        char a=getchar();
        if(a==EOF||a=='\n'){
            if(c_cnt!=0){
                if(summing){
                    list1.push_back(sum);
                    summing= false;
                    sum=0;
                }
                printf("%d",list1.size());
                for(auto num:list1){
                    printf(" %d",num);
                }
                printf("\n");
                list1.clear();
            }
            c_cnt=0;
            if(a==EOF){
                break;
            }
        }else if(a>='0'&&a<='9'){
            summing= true;
            sum*=10;
            sum+=a-'0';
        }else{
            if(summing){
                list1.push_back(sum);
                sum=0;
                summing= false;
            }
            c_cnt++;
        }
    }
    return 0;
}

